package dto;

import java.util.Iterator;
import java.util.Vector;

public class Account implements java.io.Serializable {

    private static final long serialVersionUID = 3786174460162641813L;
    private String firstName;
    private String lastName;
    private String email;
    private String password;
    private String statusMsg;
    private String userMood = "Available";
    private String status = "OFFLINE";
    private String gender;
    private String country;
    private Vector<Message> offlineMessages = new Vector<>(0);
    private Vector<Account> contactList = new Vector<>(0);

    public Account() {
    }

    @Override
    public String toString() {
        return getEmail();
    }

    public Account(String firstName, String lastname, String email, String password) {
        this.firstName = firstName;
        this.lastName = lastname;
        this.email = email;
        this.password = password;
    }

    public Account(String firstName, String lastname, String email, String password, String gender, String country) {
        this.firstName = firstName;
        this.lastName = lastname;
        this.email = email;
        this.password = password;
        this.gender = gender;
        this.country = country;
    }

    public Account(String firstName, String lastname, String email, String password,
            String statusMsg, String gender, String country,
            Vector<Message> offlineMessages, Vector<Account> contactList) {
        this.firstName = firstName;
        this.lastName = lastname;
        this.email = email;
        this.password = password;
        this.statusMsg = statusMsg;
        this.gender = gender;
        this.country = country;
        this.offlineMessages = offlineMessages;
        this.contactList = contactList;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getStatusMsg() {
        return this.statusMsg;
    }

    public void setStatusMsg(String statusMsg) {
        this.statusMsg = statusMsg;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getCountry() {
        return this.country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public Iterator<Message> getOfflineMessages() {
        return offlineMessages.iterator();
    }

    public void setOfflineMessages(Vector<Message> offlineMessages) {
        this.offlineMessages = offlineMessages;
    }

    public Iterator<Account> getContactList() {
        if(contactList == null)
            return null;
        return contactList.iterator();
    }

    public void setContactList(Vector<Account> contactList) {
        this.contactList = contactList;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getUserMood() {
        return userMood;
    }

    public void setUserMood(String userMood) {
        this.userMood = userMood;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Account) {
            return email.equals(((Account) obj).email);
        } else {
            return super.equals(obj);
        }
    }

    @Override
    public int hashCode() {
        return email.hashCode();
    }
}
